﻿using Microsoft.Extensions.Configuration;
using MiniFox.Configurations;

namespace MiniFox.Mail.Configurations
{
    /// <summary>
    /// 
    /// </summary>
    [Section(ELEMENT_NAME)]
    public sealed class MailingConfiguration
    {
        internal const string ELEMENT_NAME = "minifox:mailing";

        /// <summary>
        /// 
        /// </summary>
        public MailingConfiguration() { }

        /// <summary>
        /// 邮件帐户配置集
        /// </summary>    
        [ConfigurationKeyName("mailAccounts")]
        public MailAccountCollection MailAccounts
        {
            get;
            set;
        } = new();

        /// <summary>
        /// 默认邮件帐户
        /// </summary>    
        [ConfigurationKeyName("default")]
        public string Default
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        public MailAccount DefaultAccountSetting
        {
            get
            {
                return this.MailAccounts[this.Default];
            }
        }
    }
}
